package com.yisen.dasan.config;

import com.yisen.dasan.interceptors.JWTInterceptors;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @AuthorList: LiuYiSen
 * @Date: 2020/10/25 15:58
 */
@Configuration
public class Config {
    @Bean
    public JWTInterceptors jwtInterceptors(){
        return new JWTInterceptors();
    }
    /**
     * type类型对应表名
     * @return
     */
    @Bean
    public Map<String,String> typeMap(){
        HashMap<String, String> map = new HashMap<>();
        map.put("radio", "form_radio");
        map.put("completion", "form_completion");
        map.put("field","form_field");
        map.put("number","form_number");
        map.put("multiple","form_multiple");
        map.put("imgSingle","form_imgradio");
        map.put("select","form_select");
        map.put("name","form_name");
        map.put("gender","form_gender");
        map.put("education","form_education");
        map.put("age","form_age");
        map.put("iphone","form_iphone");
        map.put("email","form_email");
        map.put("mobile","form_mobile");
        map.put("birthday","form_birthday");
        return map;
    }

    /**
     * 结果对应表名
     * @return
     */
    @Bean
    public Map<String,String> resultMap(){
        HashMap<String, String> map = new HashMap<>();
        map.put("radio", "answer_radio");
        map.put("completion", "answer_completion");
        map.put("field","answer_field");
        map.put("number","answer_number");
        map.put("multiple","answer_multiple");
        map.put("imgSingle","answer_imgradio");
        map.put("select","answer_select");
        map.put("name","answer_name");
        map.put("gender","answer_gender");
        map.put("education","answer_education");
        map.put("age","answer_age");
        map.put("iphone","answer_iphone");
        map.put("email","answer_email");
        map.put("mobile","answer_mobile");
        map.put("birthday","answer_birthday");
        return map;
    }
    @Bean
    public ExecutorService executors(){
        return Executors.newFixedThreadPool(5);
    }
}
